package com.zhangyi.config;//package com.bw.config;
//
//import com.bw.interceptor.MyInterceptor;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.cors.CorsConfiguration;
//import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
//import org.springframework.web.filter.CorsFilter;
//import org.springframework.web.servlet.config.annotation.CorsRegistry;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
///**
// * @BelongsProject: 0107day02
// * @BelongsPackage: com.bw.config
// * @Author: zhupengfei
// * @CreateTime: 2023-02-01  08:51
// */
//@Configuration
//public class WebMvcConfig implements WebMvcConfigurer {
//
//    @Autowired
//    private MyInterceptor myIntercepter;
//    //全局路由
//    @Override
//    public void addCorsMappings(CorsRegistry registry) {
//        registry.addMapping("/**")
//                //.allowedOrigins("*")  //注意这个变动项，这个是旧版
//                .allowedOriginPatterns("*")//这个才是新版的要求
//                .allowedMethods("GET","HEAD","POST","PUT","DELETE","OPTIONS")
//                .allowCredentials(true)
//                .maxAge(3600)
//                .allowedHeaders("*");
//    }
//
//
//    /**
//     * 静态资源
//     * @author: zhupengfei
//     * @param: [registry]
//     * @return: void
//    **/
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry
//                .addResourceHandler("/static/**")
//                .addResourceLocations("classpath:/static/");
//    }
//
//    /**
//     * 拦截器
//     * @author: zhupengfei
//     * @param: [registry]
//     * @return: void
//    **/
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(myIntercepter)
//                .addPathPatterns("/**")
//                .excludePathPatterns("/user/*","/user/*/*"
//                        ,"/doc.html","/swagger-resources","/webjars/*/*","/webjars/*","/favicon.ico","/error",
//                        "/student/fastDfsUpLoad"
//                );
//    }
//}
